import axios from '@/plugins/axios';
const BASE_API = import.meta.env.VITE_APP_BASE_APIURL as string;

import { CommontTypes, ResponseVo} from '@/type';

export namespace RoleService {
  export const pageRole = async (data:any): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/role/list',{params:data,baseURL: BASE_API});
    return res;
  };

  export const addRole = async (data:any): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/role/add',data,{baseURL: BASE_API});
    return res;
  };


  export const updateRole = async (data:any): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.post('/role/edit',data,{baseURL: BASE_API});
    return res;
  };

  export const deleteRole = async (id:string|number): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/role/delete',{params:{id},baseURL: BASE_API});
    return res;
  };


  export const findRoleById = async (id:string|number): Promise<ResponseVo<any>> => {
    let res:ResponseVo<any> = await axios.get('/role/findRoleById',{params:{id},baseURL: BASE_API});
    return res;
  };
}
